package com.dongdong.tbbrandService.impl;

import com.dongdong.mapper.TbItemCatMapper;
import com.dongdong.pojo.TbItemCat;
import com.dongdong.service.TbItemCatService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
@com.alibaba.dubbo.config.annotation.Service
public class TbItemCatServiceImpl implements TbItemCatService {
   @Autowired
   private TbItemCatMapper tbItemCatMapper;

    @Override
    public List<TbItemCat> getTree(Long id) {
        List<TbItemCat> list = tbItemCatMapper.getTree(id);

        return list;
    }


    @Override
    public void save(TbItemCat tbItemCat) {
        tbItemCatMapper.insertSelective(tbItemCat);
    }

    @Override
    public TbItemCat toUpdate(Long id) {
        return tbItemCatMapper.selectByPrimaryKey(id);
    }

    @Override
    public void update(TbItemCat tbItemCat) {
        tbItemCatMapper.updateByPrimaryKeySelective(tbItemCat);
    }

    @Override
    public void deleteAll(Long[] ids) {
        List<Integer> list = tbItemCatMapper.select3Ids(ids);
        int i = tbItemCatMapper.deleteAll(ids ,ids, list);
    }

    @Override
    public List<TbItemCat> getInfo(Long id) {
        List<TbItemCat> list =   tbItemCatMapper.getInfoId(id);
        return list ;
    }

    @Override
    public TbItemCat getInfoId(Long id) {
        TbItemCat tbItemCat = tbItemCatMapper.selectByPrimaryKey(id);

        return tbItemCat;
    }
}
